<template>
    <div>
        <el-link v-for="navmenus in list" :key="navmenus.name">
            <!--  循环判断childern是否是false-->
            <div v-for="menuChildren of navmenus.children" :key="menuChildren.path">
                <el-menu-item
                        v-if="menuChildren.show == false"
                        :key="navmenus.name"
                        :index="navmenus.path"
                >
                    {{ navmenus.meta.title }}
                </el-menu-item>
                <el-submenu v-else :key="navmenus.name" :index="navmenus.path">
                    <template slot="title">{{ navmenus.meta.title }}</template>
                    <el-menu-item
                            :key="menuChildren.name"
                            :index="navmenus.path + '/' + menuChildren.path"
                    >
                        {{ menuChildren.meta.title }}
                    </el-menu-item>
                </el-submenu>
            </div>
        </el-link>
    </div>
</template>

<script>
    import {getUserInfo} from "../../utils/auth";

    export default {
        name: "index",
        data() {
            return {
                list: []
            };
        },
        created() {
            let selection = this;
            selection.list = getUserInfo().menus;
        }
    };
</script>

<style scoped></style>
